// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import VueRouter from 'vue-router';
import axios  from 'axios';
import VueAxios from 'vue-axios';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-default/index.css';
/**
 * 样式重置
 */
import './assets/normalize.css';
/**
 * 自定义common样式
 */
import './assets/common.css';

/**
 * 载入 .vue单文件
 */
import App from './App';
import Index from './components/Index';
import Login from './components/Login';
import List from './components/List';
import Article from './components/Article';
import Comment from './components/Comments';
/**
 * 注册 vue-router
 * 	    vue-resource
 * 	     element-ui
 */

Vue.use(VueRouter);
Vue.use(VueAxios,axios);
Vue.use(ElementUI);


/**
 * 初始化路由
 */

const routes = [
  { path: '/', component: Login },
  { path: '/index', component: Index ,
	children: [
		{
			path:'',
			component: List
		},
        {
          // 当 /index/article 匹配成功，
          // UserProfile 会被渲染在 User 的 <router-view> 中
          path: 'article',
          component: Article
        },
        {
          // 当 /index/comments 匹配成功
          // UserPosts 会被渲染在 User 的 <router-view> 中
          path: 'comments',
          component: Comment
        }
      ]
  }
];

const router = new VueRouter({
	routes
});
/* eslint-disable no-new */
new Vue({
  el: '#app',
  template: '<App/>',
  components: { App },
  router
});
